package RockScissorPaper;

import javax.swing.*;
import java.awt.*;

public class RockScissorPaperWindow  extends JFrame {

    private JPanel jPanel;
    private JLabel userLabel;
    private JButton startButton;
    private JButton stopButton;
    private JTextField jTextField;

    public RockScissorPaperWindow(String title) throws HeadlessException{
        super(title);
        init();
    }

    private void init(){
        setSize(500,500);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        GridLayout Layout = new GridLayout(2,3);
        //设置 水平 和 竖直 间隙
        Layout.setHgap(10);
        Layout.setVgap(10);


         jPanel = new JPanel(Layout);
         userLabel = new JLabel("玩家姓名");
         startButton =new JButton("开始游戏");
         jTextField = new JTextField(15);

        JButton button1 = new JButton("button1");

        jPanel.add(userLabel);
        jPanel.add(startButton);
        jPanel.add(button1);
        jPanel.add(jTextField);

         setContentPane(jPanel);

    }
    public JTextField getjTextfield(){
        return jTextField;
    }
}